package com.zmn.plat.admin.controller.orderconfig.orderstock.plat;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.zmn.common.constant.GlobalConsts;
import com.zmn.manager.common.database.annotation.ReadOnlyConnection;
import com.zmn.plat.model.entity.orderconfig.orderstock.plat.PlatConfig;
import com.zmn.plat.model.entity.orderconfig.orderstock.plat.PlatConfigQuery;

/**
 * 平台配置
 *
 * @author xiangjunming
 * @since 2020年3月17日16:49:40
 */
@Controller
@RequestMapping("/plat/config/")
public class PlatConfigListController extends PlatConfigBaseController {

    private Logger logger = LoggerFactory.getLogger(PlatConfigListController.class);

    /**
     * 描述: 列表
     *
     * @param query
     *            查询实体
     * @return ModelAndView
     */
    @RequestMapping(value = "list")
    @ReadOnlyConnection
    public ModelAndView list(PlatConfigQuery query) {
        ModelAndView mav = new ModelAndView("orderconfig/orderstock/plat/list");
        List<PlatConfig> items = platConfigService.listPageByQuery(query);
        mav.addObject("items", items);
        mav.addObject("vo", query);
        mav.addObject("platList", GlobalConsts.getPlatList());
        mav.addObject("servCategList", listServCategory());
        return mav;
    }

    /**
     * 描述: 批量设置
     *
     * @return ModelAndView
     */
    @RequestMapping(value = "batchSet")
    @ReadOnlyConnection
    public ModelAndView batchSet() {
        ModelAndView mav = new ModelAndView("orderconfig/orderstock/plat/batchSet");
        mav.addObject("platList", GlobalConsts.getPlatList());
        return mav;
    }
}
